import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
    public static void main(String[] args)
    {
        BigInteger M, N, d;
        Scanner cin = new Scanner(System.in);
        
        int T = cin.nextInt();
        for (int i = 0; i < T; ++i) {
            M = cin.nextBigInteger();
            N = cin.nextBigInteger();

            M = M.pow(N.intValue() - 1);

            d = M.gcd(N);

            M = M.divide(d);
            N = N.divide(d);

            System.out.println(N + "/" + M);
        }
    }
}

